package test

import "github.com/kataras/iris/v12"

type formExample struct {
	Colors []string `form:"colors[]"` // or just "colors".
}
//展示html
func ShowFormHtml(ctx iris.Context)  {
	ctx.View("test/form.html")
}
//form表单请求
func HandleForm(ctx iris.Context){
	var form formExample
	err := ctx.ReadForm(&form)
	if err != nil {
		ctx.StopWithError(iris.StatusBadRequest, err)
		return
	}

	ctx.JSON(iris.Map{"Colors": form.Colors})
}
